package test;

import java.util.*;
public class T3 {
	public static void main(String[] args) {
		String score = "数学87分，物理76分，英语96分";
		String regex = "[^0123456789.]+";
		Scanner in = new Scanner(score);
		in.useDelimiter(regex);
		double sumGrade = 0;
		int count = 0;
		while(in.hasNext()) {
			try {
				double grade = in.nextDouble();
				sumGrade += grade;
				count ++;
				System.out.println(grade);
			}catch(InputMismatchException e){
				String t = in.next();
			}
		}
		double avgGrade = Math.round(sumGrade/count);
		System.out.println("总成绩为："+sumGrade);
		System.out.println("平均分为："+avgGrade);
	}
}
